var select2;
var userForm;
$(function () {
    select2 = $('.select2').select2()
    var columns = [
        {
            field: 'ck',
            checkbox: true
        },
        {
            field: 'bookInfoId',
            title: '书籍名称'
        },
        {
            field: 'bookInfoStatus',
            title: '书籍状态',
            formatter: function (value, row, index) {
                if (value == 0) {
                    return "连载"
                }
                if (value == 1) {
                    return "完结"
                }
            }
        },
        {
            field: 'crawlerUrl',
            title: '目标地址',
        },
        {
            field: 'createDate',
            title: '创建时间',
        }, {
            field: 'id',
            title: '操作',
            formatter: function (value, row, index) {
                if (row.isCarriedOut == 1 && row.bookInfoStatus != 1) {
                    return '<button type="button" class="btn btn-primary  btn-xs" onclick="add(\'' + value + '\')"><i class="fa fa-edit"></i> 开启任务</button>';
                } else {
                    return '<button type="button" class="btn btn-primary  btn-xs" onclick="add(\'' + value + '\')"><i class="fa fa-edit"></i> 取消任务</button>';
                }
            }
        }
    ]

    createBootstrapTable($("#table"), '/sys/crawlerCatalog/findPage', columns, true, toolbar1, 'server')
})



function resetForm() {
    $("#searchForm")[0].reset();
    $("#table").bootstrapTable('refresh');
}

// 查询
function searchForm(tableId, url, FormId) {
    var data = serializeObject("searchForm");
    var opt = {
        url: '/sys/crawlerCatalog/findPage',
        silent: true,
        query: data
    };
    $("#table").bootstrapTable('refresh', opt);
}


